from library.api.db import EntityModel, db


class Feedback(EntityModel):
    ACTIVE = 0
    DISABLE = 1

    FEEDBACK = 1
    SUGGEST = 2

    title = db.Column(db.String(100))   # 标题
    contact = db.Column(db.String(200))  # 联系方式
    creator = db.Column(db.Integer)  # 创建人
    status = db.Column(db.Integer, default=ACTIVE)  # 反馈状态
    comment = db.Column(db.Text())  # 备注
    type = db.Column(db.Integer)    # 类型
    weight = db.Column(db.Integer, default=1)  # 权重，仅作用于排序

class Answer(EntityModel):
    feedback_id = db.Column(db.Integer)             # 反馈问题id
    from_user_name = db.Column(db.String(50))       # 回复用户昵称
    from_user_id = db.Column(db.Integer)            # 回复用户id
    comment = db.Column(db.Text())                  # 回复内容
    to_user_name = db.Column(db.String(50))         # 被回复用户昵称
    to_user_id = db.Column(db.Integer)              # 被回复用户id
